package com.mvc.business.model;

import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.mvc.ProjectUtils;
import com.mvc.base.model.BaseCompany;
import com.mvc.base.model.Courier;
import com.mvc.base.model.Customer;
import com.mvc.base.model.Picture;

/**
 * 
 * @author snowpbx
 * @version V1.0 Create Time: 2012-9-4
 */
@Entity(name = "B_SAMPLE")
public class Sample extends BaseCompany {
	private Integer	         orderId;
	@NotNull
	private Integer	         customerId;
	@NotNull
	private Date	         invoiceDate;
	@NotNull
	private String	         reason;
	private String	         remark;
	private String	         signatureUser;
	@NotNull
	private Double	         weight;
	@NotNull
	private Double	         unitPrice;
	@NotNull
	private Double	         amount;
	@NotNull
	private Integer	         currency;
	private Integer	         courierId;
	@Length(max = 32)
	private String	         courierNo;

	@Transient
	private List<SampleItem>	sampleItems;

	@Transient
	private List<Picture>	 pictures;

	@Transient
	private Customer	     customer;
	@Transient
	private Courier	         courier;

	public Integer getOrderId() {
		return orderId;
	}

	public void setOrderId(Integer orderId) {
		this.orderId = orderId;
	}

	public String getOrderNo() {
		if (orderId == null) {
			return "";
		} else {
			return ProjectUtils.getOrderNo(orderId);
		}

	}

	public String getReason() {
		return reason;
	}

	public void setReason(String reason) {
		this.reason = reason;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getSignatureUser() {
		return signatureUser;
	}

	public void setSignatureUser(String signatureUser) {
		this.signatureUser = signatureUser;
	}

	public Date getInvoiceDate() {
		return invoiceDate;
	}

	public void setInvoiceDate(Date invoiceDate) {
		this.invoiceDate = invoiceDate;
	}

	public String getNo() {
		return ProjectUtils.getSampleNo(getObjectId());
	}

	public Double getWeight() {
		return weight;
	}

	public void setWeight(Double weight) {
		this.weight = weight;
	}

	public Double getUnitPrice() {
		return unitPrice;
	}

	public void setUnitPrice(Double unitPrice) {
		this.unitPrice = unitPrice;
	}

	public Double getAmount() {
		return amount;
	}

	public void setAmount(Double amount) {
		this.amount = amount;
	}

	public List<Picture> getPictures() {
		return pictures;
	}

	public void setPictures(List<Picture> pictures) {
		this.pictures = pictures;
	}

	public Integer getCustomerId() {
		return customerId;
	}

	public void setCustomerId(Integer customerId) {
		this.customerId = customerId;
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public Integer getCurrency() {
		return currency;
	}

	public void setCurrency(Integer currency) {
		this.currency = currency;
	}

	public Integer getCourierId() {
		return courierId;
	}

	public void setCourierId(Integer courierId) {
		this.courierId = courierId;
	}

	public String getCourierNo() {
		return courierNo;
	}

	public void setCourierNo(String courierNo) {
		this.courierNo = courierNo;
	}

	public Courier getCourier() {
		return courier;
	}

	public void setCourier(Courier courier) {
		this.courier = courier;
	}

	public List<SampleItem> getSampleItems() {
		return sampleItems;
	}

	public void setSampleItems(List<SampleItem> sampleItems) {
		this.sampleItems = sampleItems;
	}
}
